const mysql = require('mysql');

let conn = mysql.createConnection({
    host: 'localhost',
    port: 3306,
    user: 'root',
    password: 'root',
    database: 'xiaou'
})

conn.connect();

function myQuery(sql) {
    return new Promise((resolve, reject) => {
        conn.query(sql, (err, result) => {
            resolve([err, result]);
        })
    })
}

module.exports = myQuery;